Skip to content

fix(extensions-sync): Auto-repair dangling symlinks on SMD image upgrade#247

Open
pilgd-aws wants to merge 1 commit into
aws:mainfrom
pilgd-aws:fix/repair-dangling-symlinks
Open

fix(extensions-sync): Auto-repair dangling symlinks on SMD image upgrade#247
pilgd-aws wants to merge 1 commit into
aws:mainfrom
pilgd-aws:fix/repair-dangling-symlinks

Conversation

@pilgd-aws

Copy link
Copy Markdown

Summary

Adds repairDanglingSymlinks() to the sagemaker-extensions-sync extension. When a CodeEditor space restarts with a newer SMD image, pre-packaged extension symlinks become dangling (old version paths no longer exist). This fix detects and re-links them automatically before the existing sync logic runs.

What it does

  • Scans PV extensions dir for symlinks where stat() fails (dangling)
  • Matches each to the current image version by stripping the version from the dirname
  • Re-links to the new image path, or cleans up if the extension was removed
  • Respects .obsolete file to avoid re-installing user-uninstalled extensions
  • Calls refreshExtensionsMetadata() to force VS Code rescan

Testing

  • Unit test: 5 scenarios, 19 assertions (version bump, extension removed, user-uninstalled, valid symlink untouched, real dir untouched)
  • E2E test: validated in real SMD 3.9.6-cpu container with simulated upgrade (10/10 assertions passed)

Change size

90 insertions, 3 deletions in patches/sagemaker/sagemaker-extensions-sync.diff

@pilgd-aws pilgd-aws requested review from a team as code owners June 16, 2026 21:14
Add repairDanglingSymlinks() to detect and fix broken symlinks in the
persistent volume when a CodeEditor space restarts with a newer SMD
image. Runs before existing sync logic so subsequent reads see clean
state. Respects .obsolete file to avoid re-installing user-uninstalled
extensions.
@azmkercso

azmkercso commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Does this need to be backported to existing release channels (1.1, 1.0)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants